package define

//ModifyFlag 状态码定义
const (
	Invalid = 0 // 无效
	Normal  = 1 // 无操作
	Add     = 2 // 增加
	Change  = 3 // 变更
	Delete  = 4 // 删除
	Reload  = 5 // 重载
)

//ApplyType 门参数应用类型定义
const (
	DoorCfg = 1 // 门参数
	DoorMap = 2 // 门状态映射
)

//ItemType 权限组类型定义
const (
	Person = 1 // 人员
	Card   = 2 // 临时卡
	Dept   = 3 // 部门
)

//CardStatus 状态码定义
const (
	CardNormal = 1 // 正常
	CardStop   = 2 // 停止
)

//CardType 卡类型定义
const (
	None   = 0 // 未授权
	Common = 1 // 通用卡
	Guest  = 2 // 临时卡
)

//RecordType 事件类型定义
const (
	EventType = 1 // 事件
	AlarmType = 2 // 告警
)

const (
	RemotePlatformOpenMethod = 0 // 平台开门
	RemoteRobotOpenMethod    = 2 // 机器人开门
)

//gRPC方法名定义
const (
	Execute     string = "execute"      // 生效
	DoorControl        = "door_control" // 门控制
	SyncTime           = "sync_time"    // 同步时间
	Reset              = "clean_device" // 格式化控制器
)

// Content-Type
const (
	URLEncoded = "application/x-www-form-urlencoded"
	Json       = "application/json"
)

// Parameter
const (
	Action = "action"
)

// 错误码
const (
	EcSuccess             = 0
	EcAuthentication      = -1
	EcParamMissing        = -2
	EcParamFormat         = -3
	EcUnsupportedAction   = -4
	EcSetCommandFail      = -5
	EcsParamExceed        = -6
	EcUnknown             = -99
	EcGroupNoNotExist     = -100
	EcDoorIDNotExist      = -101
	EcCardNoNotExist      = -102
	EcRecordIndexNotExist = -103 // TODO 这里是否需要实现？
	EcAlarmIndexNotExist  = -104
)

//错误信息
const (
	EmSuccess             = "ok"
	EmAuthentication      = "Authentication failed"
	EmParamMissing        = "Missing required parameters"
	EmParamFormat         = "Invalid parameters format"
	EmUnsupportedAction   = "Invalid operation"
	EmSetCommandFail      = "Operation failed"
	EmParamExceed         = "Parameter value out of range"
	EmUnknown             = "Undefined error"
	EmGroupNoNotExist     = `Value of "group_no" does not exist`
	EmDoorIDNotExist      = `Value of "door" does not exist`
	EmCardNoNotExist      = `Value of "card_no" does not exist`
	EmRecordIndexNotExist = `Value of "record index" does not exist`
	EmAlarmIndexNotExist  = `Value of "alarm index" does not exist`
)

const (
	TimestampFormat = "20060102T150405"
	TimeDataFormat  = "2006/01/02 15:04:05"
)
